package com.shycloud.mido.homework.mapper;

import com.shycloud.mido.homework.api.dto.WeekDataDto;
import com.shycloud.mido.homework.api.vo.HomeworkDaysPlayingModeVO;
import org.apache.ibatis.annotations.Param;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.shycloud.mido.homework.api.entity.WeekDataMember;
import com.shycloud.mido.member.api.entity.MemberActivateEntity;

import java.time.LocalDateTime;
import java.util.List;

/**
 * <p>
 * 周报数据周维度表 Mapper 接口
 * </p>
 *
 * @author baiqiang
 * @since 2021-06-15
 */
public interface WeekDataMemberMapper extends BaseMapper<WeekDataMember> {

	IPage<WeekDataMember> pageMemberListByWeek(Page<WeekDataMember> page);

	IPage<WeekDataMember> pageMemberListByWeekV2(Page<WeekDataMember> page);

	IPage<WeekDataMember> pageMemberListByWeekV3(Page<WeekDataMember> page);

	/** 查询UDID激活时间 */
	MemberActivateEntity getMidoMasterByMemberAndWeek(@Param("param") String memberId);

	/**
	 * 获取用户指定类型弹琴数据
	 *
	 * @param weekId     周报ID
	 * @param age        年龄
	 * @param playYears  琴龄
	 * @param playTarget 目标
	 * @return com.shycloud.mido.homework.api.entity.WeekDataMember
	 * @author nianhua.jiang
	 * @date 2021/6/17 13:18
	 */
	WeekDataMember getPlayData(@Param("weekId") String weekId,
			@Param("age") Integer age,
			@Param("playYears") String playYears,
			@Param("playTarget") String playTarget);

	/**
	 * 获取用户指定类型弹琴数据(日维度)
	 *
	 * @param studentId 学生ID
	 * @param startTime 开始时间
	 * @param endTime   结束时间
	 * @return com.shycloud.mido.homework.api.entity.WeekDataMember
	 * @author nianhua.jiang
	 * @date 2021/6/24 09:32
	 */
	List<WeekDataDto> getPlayDataDay(
			@Param("weekId") String weekId,
			@Param("studentId") String studentId,
			@Param("startTime") LocalDateTime startTime,
			@Param("endTime") LocalDateTime endTime,
			@Param("age") Integer age,
			@Param("playYears") String playYears,
			@Param("playTarget") String playTarget);

	List<HomeworkDaysPlayingModeVO> getHomeworkDaysPlayingMode(
			@Param("studentId") String studentId,
			@Param("startTime") LocalDateTime startTime,
			@Param("endTime") LocalDateTime endTime);

	List<HomeworkDaysPlayingModeVO> getHomeworkDaysPlayingModeHours(
			@Param("studentId") String studentId,
			@Param("startTime") LocalDateTime startTime,
			@Param("endTime") LocalDateTime endTime,
			@Param("date") String date);

	Integer getHomeworkDoneCountRank(@Param("weekId") String weekId, @Param("memberId") String memberId);

}
